package com.va.yahooweather;

import com.va.yahooweather.commons.LocationUtil;
import com.va.yahooweather.entity.YReport;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.BasicConfigurator;
import org.dom4j.DocumentException;

public class App {

    public static void main(String[] args) throws IOException, DocumentException {
        BasicConfigurator.configure();
        
        YahooWeatherService service = new YahooWeatherService();
        service.setUnit("cesious");
        List<YReport> reposts = new ArrayList<YReport>();
        
        for (int i = 0; i < args.length; i++) {
            String id = LocationUtil.getInstance().searchLocation(args[i]);
            YReport report = service.getReport(id);
            reposts.add(report);
        }
        
        for (YReport yReport : reposts) {
            System.out.println(yReport);
        }
        
    }
}
